package com.tyk.bookstore.back.message.model.query;

import com.tyk.bookstore.back.message.model.constant.ServiceNoticeValidateConstant;
import com.tyk.bookstore.back.message.model.enume.NoticeState;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author tyk
 * @description 服务公告
 */
@Data
@Schema(name = "ServiceNoticeUpdateQuery", description = "服务公告")
public class ServiceNoticeUpdateQuery implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "ID")
    @NotNull
    @Min(value = 1)
    private Long id;


    @Schema(description = "标题")
    @NotBlank
    @Size(min = ServiceNoticeValidateConstant.TITLE_MIN_LENGTH, max = ServiceNoticeValidateConstant.TITLE_MAX_LENGTH)
    @Pattern(regexp = ServiceNoticeValidateConstant.TITLE_REGEXP)
    private String title;

    @Schema(description = "内容")
    @NotBlank
    @Size(min = ServiceNoticeValidateConstant.CONTENT_MIN_LENGTH, max = ServiceNoticeValidateConstant.CONTENT_MAX_LENGTH)
    @Pattern(regexp = ServiceNoticeValidateConstant.CONTENT_REGEXP)
    private String content;

    @Schema(description = "署名")
    @NotBlank
    @Size(min = ServiceNoticeValidateConstant.SIGNATURE_MIN_LENGTH, max = ServiceNoticeValidateConstant.SIGNATURE_MAX_LENGTH)
    @Pattern(regexp = ServiceNoticeValidateConstant.SIGNATURE_REGEXP)
    private String signature;

    @Schema(description = "状态[0未发布,1已发布]")
    @NotNull
    private NoticeState state;

    @Schema(description = "定时发布")
    private Boolean timedRelease;

    @Schema(description = "发布时间")
    @Future
    private LocalDateTime releaseTime;

}
